package models

import "time"

var TravelStatus map[int]string

// 校车行程
type Travel struct {
	Id            int64      `orm:"description(自增主键)"`
	Sn            string     `orm:"description(行程唯一标识)"`
	Device        *Device    `orm:"rel(fk);null;default(0);description(设备id)"`
	Students      []*Student `orm:"rel(m2m);rel_through(anban/models.TravelStudent)"`
	Lat           float64    `orm:"digits(12);decimals(6);description(最近一次纬度)"`
	Lng           float64    `orm:"digits(12);decimals(6);description(最近一次经度)"`
	Status        int        `orm:"description(行程状态，1进行中 2已结束)"`
	StatusShow    string     `orm:"-"`
	StartTime     time.Time  `orm:"auto_now_add;type(datetime);description(行程开始时间)"`
	StartTimeShow string     `orm:"-"`
	EndTime       time.Time  `orm:"type(datetime);null;description(行程结束时间)"`
	EndTimeShow   string     `orm:"-"`
}

func init() {
	TravelStatus = map[int]string{
		0: "未知",
		1: "进行中",
		2: "已结束",
	}
}